Imports System.Data
Imports DAOMain.CommonDAO
Imports System.IO

Partial Class DB_Update_Update
    Inherits System.Web.UI.Page

    Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpdate.Click


        If FileUpload1.PostedFile.ToString <> "" Then
            Dim strCommands As String = ""

            txtDBUpdate.Text = ""

            If Trim(FileUpload1.PostedFile.FileName) <> "" Then
                strCommands = File.ReadAllText(FileUpload1.PostedFile.FileName)
            End If

            strCommands = Replace(strCommands, "--********************************************************************************************************", "", , , CompareMethod.Text)

            Dim cmdArray As String() = ParseCommands(strCommands)

            Dim i As Integer

            For i = 0 To cmdArray.Length - 1
                If Trim(cmdArray(i)) <> "" Then
                    Dim dm As New DAOMain.CommonDAO

                    txtDBUpdate.Text &= "Command No " & i + 1 & " : " & dm.ExecCommandWithTrapping(Trim(cmdArray(i))) & vbCrLf
                End If
            Next
        End If
    End Sub

    Private Function ParseCommands(ByVal CommandText As String) As String()
        Dim x As String()

        x = Split(CommandText, "GO")

        Return x
    End Function
End Class
